
const product = {
    state: {
        selectProduct:{}, // 已选的商品
        goodsGroupPurchaseId:undefined, //拼团的Id
    },
    mutations: {
        SET_PRODUCTARR: (state, arr) => {
            state.selectProduct = arr
        },
        SET_GROUPID: (state, id) => {
            state.goodsGroupPurchaseId = id
        },
    
    },

    actions: {
        //获取字典
        getDict({ commit, state }) {
            return new Promise((resolve, reject) => {
                if (state.dictAll.length ) {
                    if (code) {
                        resolve(state.dictAll.find((i) => i.code == code))

                        return
                    }

                    resolve(state.dictAll)
                    return
                }

                let dict = sessionStorage.getItem('qmx_ant_dict')

                dict = dict ? JSON.parse(dict) : undefined


               
            })
        },

    },
    getters:{

        selectProduct: state => state.selectProduct,
        goodsGroupPurchaseId: state => state.goodsGroupPurchaseId
    }
}

export default product
